<?php


class Blackbird_Form_ContactForm_Index extends Zend_Form
{
	function __construct($options = null)
	{
		parent::__construct($options);

		$this
			->addElement('text', 'firstname', array(
				'class' => 'important',
				'filters' => array('StripTags', 'StringTrim'),
				'label' => 'Nombres:',
				'maxlength' => 100,
				'required' => true,
				'style' => 'width:350px',
				'validators' => array(array('StringLength', true, array('min' => 2, 'max' => 100))),
			))

			->addElement('text', 'lastname', array(
				'class' => 'important',
				'filters' => array('StripTags', 'StringTrim'),
				'label' => 'Apellidos:',
				'maxlength' => 100,
				'required' => true,
				'style' => 'width:350px',
				'validators' => array(array('StringLength', true, array('min' => 2, 'max' => 100))),
			))

			->addElement('text', 'email', array(
				'class' => 'important',
				'description' => 'Por favor asegúrese de utilizar una cuenta de correo válida.',
				'filters' => array('StripTags', 'StringTrim'),
				'label' => 'Dirección de correo electrónico:',
				'maxlength' => 200,
				'required' => true,
				'style' => 'width:350px',
				'validators' => array('EmailAddress', array('StringLength', true, array('min' => 1, 'max' => 200))),
			))

			->addElement('textarea', 'message', array(
				'cols' => 65,
				'filters' => array('StripTags', 'StringTrim'),
				'label' => 'Mensaje:',
				'required' => true,
				'rows' => 7,
				'style' => 'width:450px',
				'validators' => array(array('StringLength', true, array('min' => 1, 'max' => 1500))),
			))

			->addElement('button', 'submit', array(
				'label' => 'Enviar',
				'ignore' => true,
				'type' => 'submit',
			))

			->addElement('button', 'cancel', array(
				'label' => 'Cancelar',
				'ignore' => true,
				'type' => 'button',
				'onclick' => 'history.go(-1)',
			))
			;

		$this->submit
			->removeDecorator('DtDdWrapper')
			->addDecorator('HtmlTag', array(
				'class' => 'buttons',
				'openOnly' => true,
				'placement' => Zend_Form_Decorator_Abstract::PREPEND,
				'tag' => 'dd',
			));

		$this->cancel
			->removeDecorator('DtDdWrapper')
			->addDecorator('HtmlTag', array(
				'closeOnly' => true,
				'placement' => Zend_Form_Decorator_Abstract::APPEND,
				'tag' => 'dd',
			));
	}
}

